import requests

s = requests.session()

# 登录
url = "http://127.0.0.1:8000/api/user/login"
r = s.post(url, json={'userName': 'admin', 'password': '123456', 'remember': False})
print(r.text)

url = "http://127.0.0.1:8000/api/admin/question/edit"
cs = {"id": None, "questionType": 1, "gradeLevel": 1, "subjectId": 2, "title": "<p>一年有多少天</p>",
      "items": [{"prefix": "A", "content": "365"}, {"prefix": "B", "content": "366"},
                {"prefix": "C", "content": "平年有365，瑞年有366"}, {"prefix": "D", "content": "不知道"}],
      "analyze": "<p>C</p>", "correct": "C", "score": 12, "difficult": 2}
r = s.post(url, json=cs)
assert r.json()['message'] == "成功"
